package router

import (
	"{{.ProjectName}}/internal/controller"

	"gitee.com/wu-jin-feng/fgin"
	"github.com/gin-gonic/gin"
	"google.golang.org/grpc"
)

type Router struct {
	F          *fgin.Fgin
	Router     *gin.Engine
	GrpcServer *grpc.Server
}

func NewRouter(ctr *controller.Controller) *Router {
	f := ctr.F
	router, grpcServer := f.GetHttpGrpcServer("../configs/cfg.yaml")
	greeterRouter := &GreeterRouter{f, grpcServer, router, ctr.GreeterController}
	greeterRouter.InitRouter()
	return &Router{
		f, router, grpcServer,
	}
}
